package com.hzlj.position.locate.common.dto.differentiationConfig;

import com.fz.common.base.exception.PubException;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

@Data
@ToString
@Accessors(chain = true)
public class DifferentiationConfigExtDTO {
    private PowerOff powerOff = new PowerOff(4, "10,5,5,3");
    private TraceCheck traceCheck = new TraceCheck();

    @Data
    @ToString
    @Accessors(chain = true)
    public static class PowerOff {
        /**
         * 重试次数，这里的重试次数包含号码检测。
         * 所以：如果页面上显示是3次，其实最后一次是号码检测
         */
        private Integer times;
        /**
         * 每次的分钟数间隔，多个用,隔开
         */
        private String timesDuration;
        /**
         * 文本描述
         */
        private String retryStep="平台核查-AI无感监测（第%d次）";
        //处理正常的备注
        private String normalRemark="系统通过自动核查后（AI无感监测）结果：未关机。";
        public PowerOff() {
        }

        public PowerOff(Integer times, String timesDuration) {
            this.times = times;
            this.timesDuration = timesDuration;
        }


        public Integer getDuration(Integer retry) {
            String[] split = timesDuration.split(",");
            if (split.length < retry) {
                throw new PubException(String.format("未配置第%d的重试间隔", retry));
            }
            return Integer.parseInt(split[retry - 1]);
        }
    }


    @Data
    @ToString
    @Accessors(chain = true)
    public static class TraceCheck {
        //第一步
        private String noticeJzryStep = "平台核查";
        //第二步
        private String jzryReportStep = "矫正对象上报";
        //第三步
        private String noticeGzryStep = "结果通知工作人员";

        //处理正常的备注
        private String normalRemark = "矫正对象位置确认正常，系统自动处理为核实正常";
        private String abnRemark = "该条记录为系统自动核查后（AI语音核查）矫正对象上报位置：越界。";
    }


}
